/**
 * Benchmark Entry Point
 * 
 * This script provides a simple CLI to run different benchmarks.
 */

// Import all benchmark scripts
import { formatNumber } from './utils';

// Define available benchmarks
const BENCHMARKS = {
  'actor-throughput': 'Measures how many messages an actor can process per second',
  'concurrency': 'Tests actor system performance under high concurrency',
  'http-server': 'Tests actor system as a backend for HTTP server',
  'all': 'Run all benchmarks in sequence'
};

async function main() {
  console.log('🔥 Kameo Benchmark Suite 🔥');
  console.log('===========================\n');
  
  // Parse command line arguments
  const args = process.argv.slice(2);
  const benchmark = args[0] || 'all';
  
  if (!BENCHMARKS[benchmark]) {
    console.log('Available benchmarks:');
    Object.entries(BENCHMARKS).forEach(([name, description]) => {
      console.log(`- ${name}: ${description}`);
    });
    process.exit(1);
  }
  
  console.log(`Running benchmark: ${benchmark}\n`);
  const startTime = Date.now();
  
  try {
    if (benchmark === 'all' || benchmark === 'actor-throughput') {
      console.log('\n🧪 Running Actor Throughput Benchmark');
      console.log('----------------------------------------');
      await import('./actor-throughput');
    }
    
    if (benchmark === 'all' || benchmark === 'concurrency') {
      console.log('\n🧪 Running Concurrency Benchmark');
      console.log('----------------------------------');
      await import('./concurrency');
    }
    
    if (benchmark === 'all' || benchmark === 'http-server') {
      console.log('\n🧪 Running HTTP Server Benchmark');
      console.log('----------------------------------');
      await import('./http-server');
    }
    
    const totalTime = (Date.now() - startTime) / 1000;
    console.log(`\n✅ All benchmarks completed in ${formatNumber(totalTime, 'seconds')}`);
  } catch (error) {
    console.error('\n❌ Benchmark failed:', error);
    process.exit(1);
  }
}

main(); 